package com.yan.design.java8.k2.cc;

import com.yan.design.pojo.Uo;

import java.util.ArrayList;
import java.util.List;

/**
 * lambad表达式  - 测试
 * @author shengren.yan
 * @author shengren.yan
 * @create 2022-08-23
 */
public class testRun {

    public static void main(String[] args) {

        List<Uo> list = new ArrayList<>();
        list.add(new Uo("A",1));
        list.add(new Uo("B",10));
        list.add(new Uo("C",12));
        list.add(new Uo("D",15));

        List<Uo> list1 = doList(list, new AMyPrecc());
        System.out.println(list1);


    }

    public static List<Uo> doList(List<Uo> list ,MyPrecc<Uo> a){
        List<Uo> listR = new ArrayList<>();
        for (Uo o :list){
            if(a.test(o)){
                listR.add(o);
            }
        }
        return listR;
    }

}
